/* eslint-disable */
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import VueResource from 'vue-resource';
import Vuex from 'vuex';
import store from './vuex/store';
import VueSocketio from 'vue-socket.io';


Vue.use(ElementUI);
Vue.use(VueResource);
Vue.use(Vuex);
// Vue.use(VueSocketio, 'http://chenga-w7.corp.oocl.com:8098/');
Vue.use(VueSocketio, 'http://lijo9-w7:8098/');
Vue.config.productionTip = false;

router.beforeEach((to, from, next) => {

  if (to.path === '/login') {
    sessionStorage.removeItem('user');
  }
  let user = JSON.parse(sessionStorage.getItem('user'));
  if (!user && (to.path === '/PCM_AutomationViewer/TestCaseTable' || to.path === '/PCM_AutomationViewer/mock')) {
    next({ path: '/login' })
  }
  else {
    next()
  }
});
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
});
